---
title: "Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library("p8105.datasets")
library(plotly)
data("instacart")
data("ny_noaa")
data("rest_inspec")
```
```{r}
# nyc_airbnb <-
# nyc_airbnb %>%
# mutate(rating = review_scores_location / 2) %>%
# select(neighbourhood_group, neighbourhood, rating, price, room_type, lat, long) %>%
# filter(
# neighbourhood_group == "Manhattan",
# price %in% 100:500,
# room_type == "Entire home/apt"
# ) %>%
# drop_na(rating)
#
# instacart2 <-
# instacart %>%
# filter(department == "alcohol") %>%
# group_by(product_name) %>%
# summarize(n = n())
#
# instacart %>% group_by(department) %>%
# summarize(n = n())
#
# instacart %>% count(aisle) %>% arrange(desc(n))
#
# instacart2 <-
# instacart %>%
# filter(department == "alcohol") %>%
# #group_by(aisle) %>%
# count(product_name) %>%
# mutate(rank = min_rank(rank(desc(n)))) %>%
# filter(rank <= 50) %>%
# arrange(desc(n))
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
# instacart %>%
# filter(department == "alcohol") %>%
# select(product_name, order_dow, order_hour_of_day) %>%
# plot_ly(
# x = ~product_name, y = ~count(product_name),
# alpha = 0.5, type = "scatter", mode = "markers")
#
# instacart %>%
# plot_ly(
# x =
# )
#
# ?plot_ly
```
Column {data-width=350}
-----------------------------------------------------------------------
### Chart B
```{r}
# nyc_airbnb %>%
# mutate(neighbourhood = fct_reorder(neighbourhood, price)) %>%
# plot_ly(
# y = ~price, x = ~neighbourhood, color = ~neighbourhood,
# type = "box", colors = "viridis")
```
### Chart C
```{r}
instacart %>%
filter(department == "alcohol") %>%
count(product_name, aisle) %>%
mutate(rank = min_rank(rank(desc(n)))) %>%
filter(rank <= 50) %>%
mutate(product_name = fct_reorder(product_name, n)) %>%
plot_ly(x = ~product_name, y = ~n, color = ~aisle, type = "bar", colors = "viridis")
```